employees = {
    "John": {
        # 一个季度的考勤天数
        "attendance": [20, 22, 19],
        # 附加信息
        "extra_info": {
            # 职位
            "position": "Manager",
            # 联系方式
            "contact": "13012345678"
        }
    },
  "Jim": {
# 一个季度的考勤天数
        "attendance": [21, 21, 19],
        # 附加信息
        "extra_info": {
            # 职位
            "position": "Worker",
            # 联系方式
            "contact": "14512345678"
        }
  },
  "Linda": {
# 一个季度的考勤天数
        "attendance": [21, 22, 20],
        # 附加信息
        "extra_info": {
            # 职位
            "position": "Worker",
            # 联系方式
            "contact": "13012345678"
        }
  }
}

# 1.添加员工
# 更新的数据是一个字典
new_employee = {"Amy": {
  "attendance": [18, 21, 22],
      # 附加信息
  "extra_info": {
      # 职位
      "position": "Worker",
      # 联系方式
      "contact": "17613335678"
        }
   }
}
employees.update(new_employee)
new_employee_name = list(new_employee.keys())[0]
print(f"您已添加{new_employee_name}，更新后的信息系统如下：")
print(employees)

# 2.更新员工考勤信息
# 定义要修改考勤信息的员工
update_employee_name = "Jim"
if update_employee_name not in employees:
  print("您所要修改考勤的员工不在系统中！")
else:
  update_employee = employees.get(update_employee_name)
  update_employee_inform = {"attendance" : [20, 20, 20]}
  update_employee.update(update_employee_inform)
  print(f"更新{update_employee_name}考勤后的信息系统如下：")
  print(employees)

# 3.删除员工信息
del_employee_name = "Linda"
if del_employee_name not in employees:
  print("您所要删除的员工不在系统中！")
else:
  del_employee = employees.pop(del_employee_name)
  print(f"您删除了{del_employee_name}，删除后的员工信息系统如下：")
  print(employees)

# 4.获取员工列表
name_list = []
for k in employees :
  name_list.append(k)
print("系统中的员工姓名有：")
print(name_list)

# 5.查找员工信息
search_name = "John"
if search_name not in employees:
  print("您所要查询的员工不在系统中！")
else:
  search_employee = employees.get(search_name)
  print(f"{search_name}的信息如下")
  print(search_employee)





